<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./script/d3.v7.min.js"></script>
</head>
<body>
<div class="test">element no.1</div>
<div class="test">element no.2</div>
<div class="test" id="3">element no.3</div>
<div class="test">element no.4</div>
<div class="test">element no.5</div>
</body>
<script>
    var data_array=[1,3,4,5,5,6]
    d3.selectAll('.test').data(data_array).text(function (d,i) {
        if(i==3)return 'this is i3'
        return d
    })
</script>
</html>